package top.whk0710.leetcode.FindMidNode;

import java.util.Arrays;

public class Solution {

	public static void main(String[] args) {
//		ListNode n1 = new ListNode(1);
//		ListNode n2 = new ListNode(2);
//		ListNode n3 = new ListNode(3);
//		ListNode n4 = new ListNode(4);
//		ListNode n5 = new ListNode(5);
//		ListNode n6 = new ListNode(6);
//		ListNode n7 = new ListNode(7);
//		n1.next = n2;
//		n2.next = n3;
//		n3.next = n4;
//		n4.next = n5;
//		n5.next = n6;
//		n6.next = n7;
//		
//		findMidNode(n1);
		
		int a = 10;
		int b = 20;
//		a = a+b;
//		b = a-b;
//		a = a-b;
		
//		int tmp = 0;
//		tmp = a;
//		a = b;
//		b = tmp;
		
		a = a ^ b;
		b = b ^ a;
		a = a ^ b;
		
		System.out.println(a);
		System.out.println(b);
	}
	
	public static void findMidNode(ListNode root){
		
		if(root == null){
			return;
		}
		
		ListNode slow = root;
		ListNode fast = root;
		
		while(fast!=null && fast.next!=null && fast.next.next!=null){
			fast = fast.next.next;
			slow = slow.next;
		}
		
		System.out.println(slow.val);
	}
}
class ListNode{
	int val;
	ListNode next;
	
	public ListNode(int val){
		this.val = val;
	}
}